﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using CarolLib.Configuration;

namespace MM.Configuration
{
    public class HostSetting
    {

        public HostSetting(XmlNode node)
        {
            XmlAttributeCollection atts = node.Attributes;

            this.SmtpServer = ConfigurationBase.GetStringAttribute(atts, "smtpserver", string.Empty);
            this.SmtpPort = ConfigurationBase.GetStringAttribute(atts, "smtpport", string.Empty);
            this.UserName = ConfigurationBase.GetStringAttribute(atts, "username", string.Empty);
            this.Password = ConfigurationBase.GetStringAttribute(atts, "pwd", string.Empty);
            this.SendAddress = ConfigurationBase.GetStringAttribute(atts, "sendaddress", string.Empty);
            this.Subject = ConfigurationBase.GetStringAttribute(atts, "subject", string.Empty);
            this.TO = ConfigurationBase.GetStringAttribute(atts, "to", "|").Split('|');
            this.CC = ConfigurationBase.GetStringAttribute(atts, "cc", "|").Split('|');

            this.SmsServer = ConfigurationBase.GetStringAttribute(atts, "smsserver", "");
            this.SendNumber = ConfigurationBase.GetStringAttribute(atts, "sendnumber", "|").Split('|');

        }

        public string SmtpServer { get; set; }

        public string SmtpPort { get; set; }

        public string UserName { get; set; }

        public string Password { get; set; }

        public string SendAddress { get; set; }

        public string Subject { get; set; }

        public string[] TO { get; set; }

        public string[] CC { get; set; }

        public string SmsServer { get; set; }

        public string[] SendNumber { get; set; }

    }
}
